import { Directive, OnInit, AfterViewInit, ElementRef } from '@angular/core';

@Directive({
    selector: '[textOverflow]'
})
export class TextOverflowDirective implements OnInit, AfterViewInit {
    constructor(private _element: ElementRef) {}

    ngAfterViewInit(): void {
        console.log(this._element);
        this._element.nativeElement.style['overflow'] = 'hidden';
        this._element.nativeElement.style['white-space'] = 'nowrap';
        this._element.nativeElement.style['text-overflow'] = 'ellipsis';
        this._element.nativeElement.style['cursor'] = 'help';

        this._element.nativeElement.setAttribute('title', this._element.nativeElement.innerText);
    }
    ngOnInit(): void {}
}
